package com.fingard.dsp.bank.directbank.citic05.util;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class H5Demo
{
    /*public String createH5ReqStr()
    {
        JSONObject reqBusiData = new JSONObject();

        reqBusiData.put("OPENVER", "1.0.0");
        reqBusiData.put("OPENTRANSCODE", "IFOPD001");
        reqBusiData.put("OPENMERCODE", "CITICIFOP9999997");
        reqBusiData.put("OPENMERNAME", "xxå¹³å°");
        reqBusiData.put("OPENBUSITYPE", "104");
        reqBusiData.put("OPENLAUNCHDATE", "20191224");
        reqBusiData.put("OPENLAUNCHTIME", "091123");

        reqBusiData.put("argName1", "argValue1");
        reqBusiData.put("argName2", "");


        JSONArray jsonArray = new JSONArray();

        int jsonArrayLength = 10;
        for (int i = 0; i < jsonArrayLength; i++)
        {
            JSONObject arrayData = new JSONObject();
            arrayData.put("arrayArgName1", "arrayArgValue1");

            jsonArray.add(arrayData);
        }
        reqBusiData.put("arrayName", jsonArray);
        CiticSdk sdk = new CiticSdk();

        String publikeyStr = "MIIDQTCCAimgAwIBAgIBMDANBgkqhkiG9w0BAQUFADA6MQswCQYDVQQGEwJDTjENMAsGA1UECwwEQ05DQjEcMBoGA1UEAwwTYjJjLmJhbmsuZWNpdGljLmNvbTAgFw0xODEwMjIwMjU0MjZaGA8yMTE4MDkyODAyNTQyNlowOjELMAkGA1UEBhMCQ04xDTALBgNVBAsMBENOQ0IxHDAaBgNVBAMME2IyYy5iYW5rLmVjaXRpYy5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCJe5k8J5oxkRbfrNHHbN8MEce9lkV/HWrKtpEtknRICpyT24Rx3xiCkyFfC2Zn0sYofJAcAvKElDupIIuYJHMvwWgakYHVHAbsp8XfGDToDeZdabCPSaV/tC+pbcZjnF+Zdlmy/TL9Yzxe/lSqhAnjk2wIeBQUy27CpcOKO7GXMVFE9TgogqDND+hYYzyaj+8gh73DRu2xSAq+ZTvJuW+bPvuALEOK/Ex8MO9u0oV1nn3OwkP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3vQ3WeWnk3tEEqWy1Bgn+W0RsGwciJkXG+EI4UwEoSGbh2rR+7Tyg90pjHYMKzt/DXPwhLigg7+EczH2teUCMGsnleJpr5bHwR9Fcr4QVGEVeW7brzK+7Ep5CbA6JMDsoNgk=";

        String privatekeyPwd = "123456";
        sdk.setPrivateKeySignatureWithPwdUseStr(privatekeyStr, privatekeyPwd);
        JSONObject reqEcryptyData = new JSONObject();
        try
        {
            String bussEncryptData = sdk.encryptBusiness(reqBusiData.toString());
            String signStr = sdk.signature(reqBusiData.toString());
            reqEcryptyData.put("encryptBody", bussEncryptData);
            reqEcryptyData.put("sign", signStr);
        }
        catch (AppException e) {}
        return reqEcryptyData.toString();
    }

    public String decryptCallBackData(String packet)
    {
        CiticSdk sdk = new CiticSdk();

        String privateKeyStr = "A1JTQcJKdZpNAvY7BTPPO/LQPA6245ZnX1/TksR4vBL/QwvHBaeCxT1Kotv0/GeaaGnQcqMI7u0tDxM5QQEb7EiXq4/653d3cFpNjjRKXclaTwKIBhHlaj4t4yboYKpbGlfjT4AZnFd30VuSabPP3f/dXh9zE3F+ZDh+AKaKp8J5pU6soEllOBN2mZBls45Y1COKCsxarGu4OPEpsIKwZJVNixPbbUy3+RRblN8UZwNIbdia28qpgX2umfr5sUXiZSf+auHyoehDcKoZSlW7XqfoVBkjAZOheRGwU75mHErsMyl/9qu1MQxX5Jf26dyX6qakiNxO2B1ye0CJ4CaPds7TS64cU3WmLGZvmbd8/sLhUwQPy0sYmgdgRG8NMmW89Nr8/HfbSPOwynORlm/rNoxFI1YvHr6qZi2gz5OYQXmA568443xG+mYpL/hCXpgmwcCi+JBsEhi5g1qzOzh36RO9ZV9ba4F1+AYjs09Kh965iphUstnFrUsyyHpxxL7mUAcl3CHnuUbXBbg0IZ2jXUHFjuUv5cPO/aTAdSv4RWoFbThMSzTMEcoA/hZ907Gvbh4gLoEWY5B9A6j880+A4AlAbWHQ1JjPer7e+1jbs++yRUEJJsuvvASKTlKyqTU27vuLNru02hacf2z++TUchI9/f0GCbkpgpSNLhpMOPgaaa0uZ843C00Vb42/znldeyULBQpv+jNY4ssYp99TSG21jArjRPZ+1OE29anU5E1Xr9knKJHNYO8lsLB0fXo3Vrv6Ow3oc8PQSkpK2AJLvb8o4E6VN6CyVpMH5zzfRv6o5QUmEIUPcF+RkMMGngb9M+dcXiV5Se4hBZhrZ21u8f6gC+/dSsf0LDQgEqJJrB7kABWKFlvohXCdk8/a8s8xePXViiZQq7fcjfZJroskpS0oT3sxy/tuMKotDPknsRK6Iqs8mJXZUwjHC9whhPb+zMGUkh+c9+f+oxEp6vcQjt8IOooyDRSUN5p8DLVHr6OE6y+jqMAuLj8/89ZbQW8qwrLwMaiPldlHMLmCzlYeWbq7rI9d9K0O3O+VSFpQB7O1UfUjxUqGrpk854ePUNlhOs2hvISymTTtRUUOmoPrYcAGraDmSM6OvLtcQokiWXq46g/4P0rlikg/2xlDZd9nNKW+uWFeilMdmdGMeaM05/BvbmAu0kXPbqPeEHFJzRnevyBTVweYbsQm0GULQARslDXmSMLmF9q/KMSGkQvWLfgrP2fAs+q7bh2jaE1cnvA9oXvYMfgjiYekl8T973dro7fGxZymeu0R060BjMX6Gb4pkpBqLKplmUBFsYhj+jC7bLBSj0ER7boQuu2PytRTGI/ESoOHnywnw9btz3uPePg3byB9USbJOx/+uZtS608jWapj6IR9TWEwGRUkUm0samFIKoLH332gncfDI0AOf8aBulK2SwKtgVh0uf7wWyheqfNA2XJPR2NWiwpOqJzBAbmDXjFNQ/kZh6uCREMBjb6VLgs0TfgfMXlXM7GR2GDXGWw/G1G1ZMUM0o28bklNjyQClrTWrRCxnjUg4zi07mVA7F6a4rLrUg7G0LpP5hqfRzJKFtxLbBeSrAV6vbAVrv7KrBuSFWSLPoAdFpGmknl/N38xx2I0n4L9oUvaaf8xMO98AKsSrj67M880=";

        String privateKeyPwd = "123456";
        sdk.setPrivateKeyDecryptWithPwdUseStr(privateKeyStr, privateKeyPwd);

        String publicKeyStr = "MIIDPzCCAiegAwI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ZtWMDhWYg==";
        sdk.setPublicKeyValidateSignatureUseStr(publicKeyStr);
        String busiData = "";
        try
        {
            busiData = sdk.validateSignature(packet);
        }
        catch (AppException e)
        {
            e.printStackTrace();
        }
        return busiData;
    }*/
}
